###############################################################
#
# Purpose: Makefile for "M-JPEG Streamer"
# Author.: Tom Stoeveken (TST)
# Version: 0.3
# License: GPL
#
###############################################################

CC ?= gcc

OTHER_HEADERS = ../../capture.h ../../utils.h 

CFLAGS += -O2 -DLINUX -D_GNU_SOURCE -Wall -fPIC
CFLAGS_D += -g -DLINUX -D_GNU_SOURCE -Wall -fPIC
ifeq ($(CC),arm-linux-gcc)
CFLAGS += -DUSE_SDL -I/opt/FriendlyARM/jpeg/include -I/opt/FriendlyARM/sdl/include/SDL
CFLAGS_D += -DUSE_SDL -I/opt/FriendlyARM/jpeg/include -I/opt/FriendlyARM/sdl/include/SDL
LFLAGS += -L/opt/FriendlyARM/jpeg/lib -ljpeg -L/opt/FriendlyARM/sdl/lib -lSDL -lpthread -fpic
else
CFLAGS += -DUSE_SDL -I/usr/include/SDL
CFLAGS_D += -DUSE_SDL -I/usr/include/SDL
LFLAGS += -ljpeg -lSDL -lpthread -fpic
endif

all: liboutput_viewer.so

liboutput_viewer.so: output_viewer.c roateBitmap.c roateBitmap.h $(OTHER_HEADERS) 
	$(CC) $(CFLAGS) $(LFLAGS) output_viewer.c roateBitmap.c -shared -o $@

debug: liboutput_viewer_d.so

liboutput_viewer_d.so : output_viewer.c $(OTHER_HEADERS) 
	$(CC) $(CFLAGS_D) $(LFLAGS) $< -shared -o $@
clean:
	rm -f *.a *.o core *~ *.so *.lo

.PHONY: all debug all

